package com.lai.gulimall.cart.service;

import com.lai.gulimall.cart.vo.CartItemVo;
import com.lai.gulimall.cart.vo.CartVo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.ExecutionException;


public interface CartService {


    /**
     * 添加商品到购物车
     * @param skuId
     * @param num
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    CartItemVo addProductToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 获取购物项
     * @param skuId
     * @return
     */
    CartItemVo getCartItem(Long skuId);

    /**
     * 获取购物车
     * @return
     */
    CartVo getCart(String cookieKey) throws ExecutionException, InterruptedException;

    /**
     * 清空购物车
     * @param cartKey
     */
    void clearCart(String cartKey);


    /**
     * 修改购物项状态
     * @param skuId
     * @param check
     * @return
     */
    CartVo checkItem(Long skuId, Integer check);

    /**
     * 统计购物项
     * @param skuId
     * @param num
     * @return
     */
    CartVo countItem(Long skuId, Integer num);

    /**
     * 删除购物项
     * @param skuId
     */
    void deleteItem(Long skuId);

    /**
     * 根据用户id获取用户购物项
     * @param memberId
     * @return
     */
    List<CartItemVo> getUserCartItemsById(Long memberId);
}
